{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "dfa1cb0a-b4d1-4110-b9fa-aaeaba916e52",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-07-14T03:38:48.710895Z",
     "iopub.status.busy": "2024-07-14T03:38:48.710305Z",
     "iopub.status.idle": "2024-07-14T03:38:48.720499Z",
     "shell.execute_reply": "2024-07-14T03:38:48.718881Z",
     "shell.execute_reply.started": "2024-07-14T03:38:48.710849Z"
    }
   },
   "outputs": [],
   "source": [
    "from IPython.display import Image"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "bbd22bd5",
   "metadata": {},
   "source": [
    "- 支持的 ide\n",
    "    - vscode\n",
    "    - jetbrains：暂不支持 chat\n",
    "        - pycharm\n",
    "        - idea\n",
    "\n",
    "- 主要作用\n",
    "    - 协助阅读源码；\n",
    "    - 自动代码补全；（非常智能）\n",
    "\n",
    "- 用法\n",
    "    - `@workspace`：整个工作区的提问；"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "61437bbc-c448-4776-8e6f-66cdf5031ccd",
   "metadata": {},
   "source": [
    "## gh cli"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2ae46090-c019-4187-aedf-6660faf99324",
   "metadata": {},
   "source": [
    "> 工作在 cli，也专注于命令行命令的解释、建议与输出；"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1d80e92e-a0ec-4580-8eea-a70940c279ef",
   "metadata": {},
   "source": [
    "### install"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5df9fc01-6ad7-4e7d-95a3-ccbe4fff6371",
   "metadata": {},
   "source": [
    "- install\n",
    "    - https://github.com/cli/cli/blob/trunk/docs/install_linux.md\n",
    "\n",
    "```\n",
    "$ gh auth login\n",
    "\n",
    "$ gh pr status\n",
    "\n",
    "$ gh extension list\n",
    "$ gh extension install github/gh-copilot\n",
    "$ gh extension install yusukebe/gh-markdown-preview\n",
    "$ gh extension list\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "79a8556f-7e3b-45c8-bace-c437e4c49890",
   "metadata": {},
   "source": [
    "### usage"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "dedb55ff-e688-4482-88eb-3d9974c1c605",
   "metadata": {},
   "source": [
    "> 这里其实我们可以通过这样一个成熟的现代AI产品，学习如何对软件开发进行抽象的能力；\n",
    "\n",
    "- `explain`：解释\n",
    "    - `$ gh copilot explain \"traceroute github.com\"`\n",
    "- `suggest`：交互模式（支持中文输入）\n",
    "    - `$ gh copilot suggest \"Install git\"`\n",
    "    - 其会生成一个 suggestion 的命令\n",
    "    - 进一步可以选择 copy/explain/execute/revise(修改)/rate(评分，feedback)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "bb63ceaf-2088-456e-87bc-9391db17572a",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-07-14T03:39:55.856536Z",
     "iopub.status.busy": "2024-07-14T03:39:55.855834Z",
     "iopub.status.idle": "2024-07-14T03:39:55.862842Z",
     "shell.execute_reply": "2024-07-14T03:39:55.861601Z",
     "shell.execute_reply.started": "2024-07-14T03:39:55.856499Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<img src=\"./imgs/gh_copilot_suggest.png\" width=\"400\"/>"
      ],
      "text/plain": [
       "<IPython.core.display.Image object>"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Image(url='./imgs/gh_copilot_suggest.png', width=400)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4a45f2a6-64da-4b26-9a9c-69ac24fe4ade",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.13"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
